package com.heima.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

/**
 * @Author XHui
 * @Since 2024/2/12 9:52
 * @Version 1.0
 */
public class FormatterUtil {

    public static void formatPrintAsJson(Object jsonStr) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        String string = mapper.writeValueAsString(jsonStr);
        System.out.println(string);
    }
}
